package com.fms.model.domain.messaging;

import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;

import com.fms.model.messaging.domain.DraftMessage;

public class DraftMatch extends TypeSafeMatcher<DraftMessage>
{
	private DraftMessage	message;

	public DraftMatch(DraftMessage _message)
	{
		this.message = _message;
	}

	@Override
	public boolean matchesSafely(DraftMessage item)
	{
		boolean matches  = true;
		for(int i = 0; i < item.getTo().size(); i++)
		{
			if(!item.getTo().get(i).equals(message.getTo().get(i)))
			{
				matches = false;
			}			
		}
		matches =  matches && item.getMessage().equals(message.getMessage());
		matches =  matches && item.getSheet().getFileName().equals(message.getSheet().getFileName());
		matches =  matches && item.getSubject().equals(message.getSubject());
		
		
		return matches;
	}

	public void describeTo(Description description)
	{

		
	}

}
